﻿@model DotaHelp.Models.Purchase

@{
    ViewBag.Title = "Мини дота гайд, закуп для " + Model.Hero.Name + " (" + Model.Hero.Nickname + ")";
    ViewBag.Meta_description = Model.Hero.Name + " (" + Model.Hero.Nickname + ") - мини гайд (закуп) от " + Model.Author;
    ViewBag.Meta_keywords = Model.Hero.Name + ", " + Model.Hero.Nickname + ", DotaHelp, dota, гайды, закуп, дота, герои, Dota 6.73c";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
<h2>Мини дота гайд (закуп) №@Model.Id от @Html.ShowUserName(Model.Author) @Html.Raiting("Purchases", Model.Id, Model.Raiting) @Html.CreateUserButton(Model.Author, Model.Password)</h2>


<h3>Мини дота гайд для @Model.Hero.Name (@Model.Hero.Nickname)</h3>


<div>
    @Html.LinkOnHero(Model.Hero)
   
    @if (Model.PurchasesItems.Min(_ => _.Position) == 0)
    {
        <span style="margin-left:50px">&nbsp;</span>

        foreach (var pitem in Model.PurchasesItems.OrderBy(_ => _.Position))
        {
            if (pitem.ItemId != -1)
            {
                @Html.LinkOnItem(pitem.Item)             
            }
            else
            {
                <span style="margin-left:10px"> </span>
            }

        }
    }
    else
    {
        <div style="clear:left;margin-top:15px"></div>
        
        var g = Model.PurchasesItems.ToDictionary(_=>_.Position, _=>_.Item);        
    
        @Html.Partial("Inventory", g, new ViewDataDictionary() { { "startPos", 0 }, { "Name", "Начальный" } })
        @Html.Partial("Inventory", g, new ViewDataDictionary() { { "startPos", 7 }, { "Name", "Середина игры" } })
        @Html.Partial("Inventory", g, new ViewDataDictionary() { { "startPos", 14 }, { "Name", "Финальный" } })  
        
        <div style="clear:left;margin-top:15px"></div>
    }
</div>   

@if (!string.IsNullOrWhiteSpace(Model.Comment))
{
    <h3>Применение закупа:</h3>
    <div>
        @Html.ReplaceKeyOnContent(Model.Comment, true)
        @Html.EditDialog("Purchases", "Comment", Model.Id, Model.Comment)
    </div>
}

<p>
    @Html.ActionLink("Сделать свой закуп для " + Model.Hero.Name, "Add", new { id = Model.HeroId })
</p>

<h3>Отзывы:</h3>

@Html.Comments("Закуп для " + Model.Hero.Name, Url.RouteUrl("Purchase", new { id = Model.Id }), Model.Hero.AvatarImageId)
